package com.yowasa.xiuxian.engine.travel.adventure;


import com.google.common.collect.Sets;
import com.yowasa.xiuxian.engine.travel.AdventureInterface;
import com.yowasa.xiuxian.entity.bo.user.UserBO;
import com.yowasa.xiuxian.entity.enums.MapEnum;
import com.yowasa.xiuxian.entity.enums.RefreshType;
import com.yowasa.xiuxian.service.helper.ItemHelper;
import com.yowasa.xiuxian.service.helper.ResourceHelper;
import com.yowasa.xiuxian.service.helper.UserHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Set;

/**
 * 获取万民堂水煮鱼
 */
@Component
public class OuYuXiangLing implements AdventureInterface {
    @Autowired
    private ResourceHelper resourceHelper;
    @Autowired
    private UserHelper userHelper;
    @Autowired
    private ItemHelper itemHelper;
    @Override
    public Set<MapEnum> limitMaps() {
        return Sets.newHashSet(MapEnum.PU_GONG_YING_HAI);
    }


    public boolean limitCheck(UserBO user) {
        return resourceHelper.checkHaveResource(user.getGuildId(), this.getClass().getName(), RefreshType.LOCK_TIME);
    }


    @Override
    public String exec(UserBO user) {
        String msg = "你在此地游历时偶遇了万民堂的大厨香菱，你帮她收集了许多食材，她为你做了一道万民堂水煮鱼作为感谢";

        itemHelper.addItem(user, "万民堂水煮鱼", 1);

        resourceHelper.lockResource(user.getGuildId(), this.getClass().getName(), 15 * 360);
        userHelper.lockUser(user,30,user.getName()+"探索秘境中");
        return msg;
    }

    @Override
    public boolean isConflict() {
        return true;
    }

    public int weight() {
        return 3;
    }
}
